add some docs and .gitignrore. Simplified code in aggregation.