Small changes in FactoryBase code.

- clean code
- remove debug messages
- add documentation