need to improve the query