remodeling the query