Added better sql query