Query tests

Added tests for last few query functions