Optimized and tidied the code. Fixed bugs. Use Flash library. Separate print functions and strings.