move debug functions to end of prototype