refactored project and added constructor and factory design patterns