Upgraded code