Factory pattern implemented to simplefy, test passing