Implement sorting and filtering

Addresses #97. Just waiting for Evan's filtering API
just to put it down on paper. This is to follow C++ convention, e.g. `make_shared`, `make_unique`, `make_pair`