Added visual feedback for sleep.
Added sleep and reordered code to deal with running app.