Remove debug messages and some dead code