Finished factories refactoring, minor changes in environment