fixing templates and removing debug code