Added timer. Restructured main with game loop.