made end of query less sucky