Changed to be polymorphic and added factory class