added templates, where, sort, and unique