NNFactory refactoring