improved PhpDoc
added tests
removed option to specify a factory
refactoring