Added full comments for reducer.py