Clean up and fixes in reducer code