cleaned up sql statements