Refactor debugger