Initial cleanup/changes for more modular code