Cleaned up the code, added comments, and some TODO's for what need to be done from the top of my head