Refactored constructor