Fixed issue with the query
Added comments