Characterizing and refactoring asynchronous JavaScript callbacks