Removed some debugging code and cleaned up some code