refactoring constructor