more refactorying to use component factory instead of direct components.