API changes

When register a plugin a pointer to privateData is passed down as the callback needs to have some context about where the plugin is supposed to be registered.

Also made some cleanups with regards to the registerFunction and removed some code that isn't needed anymore.