nn factory implemented