Adding before / after function hooks