Added a object factory and did some refactoring