cleanup and comments added