Factory stuff is reorganized and more flexible