reworked application.js to work with setTimeout