added comments and cleaned up more code