Added comments, cleaned code.

Additionally added support for invocation timeout injection.