Replacing factories with an abstract one