Fix bug in reducer
Cleaned up partitioner code