Cleaned up a lot of the code and added in comments. Also added TODOs for
what I would like to fix.