Upgrade refactor WIP.