Adding a function to allow library users to register their own functions.
added and tested function registering interface