Minor changes to code structure