added better query support