a little refactoring and a lot of commenting
Merge branch 'master' of https://github.com/Charlie-Y/CS147-project