builtin_handler fix and refactoring