Changed query to right formating