Refactor deft mode.