Major changes to code organization