Using the factory method pattern