Added more descriptive comments and cleaned up some unecessary code