factory returns an abstract class