Little refactoring and build fix.