refactored data processing
cleaned up