Updated query interface to work with contributions
Added tests for new query interface with contribution handling