Added application states and input-update-render loop.