implementing models and object factory