Added more sql code