Refactored the constructor