Added more sexy sql stuff