refactored initialize method