Remove dependency on factory