Added flags in raw processing
Refactored error reporting