added some comments, cleaned up spacing