Modified constructor and refactoring