Added pre_process_handler hook, modified unit tests and documentation