Refactored initialize method