Slowly start refactoring the get_handler_function and other things.