Rename config --> factory

Fix small error in refactoring

Fix other small error in refactoring