Refactored init method