Reformatted code, fixed missing semicolons, and optimized some little parts of the code STILL MISSING: THE LOT OF VERBOSITY USING IFS.