Replaced function wrapping with a class based approach.