Fixed timer and when things flip
fixed comments, indentation,  and made prettier