Added a before_method function and a before_output function and added wrappers for some functions

Added the option to customize the keys table for each of the functions and the key_row etc.. Added a fetch_key function and an iskey_valid_function