A little refactoring
Build fixes.