Major update to code