moved debug functions into class