Added generic function hijacking code - needs to be tested on an actual function