added some comments, cleaned up some code