Added the option to pass parameters and a callback via invokeHook