Cleaned up the code, fixed a few bugs, and removed over 100 unneeded lines of code.