refactor initialization process