major changes to code structure