cleaned up some code. moved list of query fields to config