Refactor the initialization method.