Created debugger class and moved debugging functions into it.