Refactor initialization