Refactor debugger init code.