added more filtering options for pending and query, some api changes