refactor to remove factories