moved reducer to its own java file