Fixed main loop (dt was improperly calculated)