Moved debug functions to separate file