Refactor initialize method