cleanup attempt at following the community style guide for more readable code
query views and return only docs - adding helper for dynamic queries