Major update to code.