refactored constructor