Small refactoring, and added raw data output