minor cleanup and added comments