added data processing code