code cleanup, fps counter, streamlined FSM