Changed to query from HDF for quicker performance. Added more tests