fixed bugs in use of debugging function from having class-ified it.