A patch to fix support for invokables

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