Hard lessons in asynchronous JavaScript code