Refactoring of constructor