adjusted all query to simplify