minor cleanup
moving constants to globals and cleaning debug code