Swapped debug code to separate files