Fixed up some code and commented