Clean up modules
Added sorting support
Fixed a bug in aggregation mapreduce