Cleaned up code and completed the program.