Internal Extensions Refactoring

* Make FunctionHandler a separate class, I'm going to use it later in a ContextObserver.
* The handler signature is much simpler and easier to extend in the future.
* Get rid of the InternalExtension class, which serves no purpose anymore.