Reducer script for enhanced data analysis