Cleaned up sql.