code updates

cleaned up some unused code and added comments