remove some debugging and minor fixes to code