more sql stuff. not finished.