Mostly removed debug code