Fixed queries.  reverted code