Cleaned up some code, added comments
Cleaned up more code