Minor fixes to code structure