big update to code