added comments. changed padding. cleaned up some code