A patch to fix support for invokables

Continuation of #59

--

Use an `isFactory` and `expectFactory` method instead of `Closure` type hinting, and some refactoring.