Added a before_method function and a before_output function