cleaning up comments and debug statements, a little bit of optimization (but really not much)