Reformatted some code
Fixed flip animation
Code cleanup
Fixed a crash at startup