Refactored the factories allowing them to accept objects