Some refactoring, output updates.