A little refactoring. Fix build