Further refactoring of debugger