sqlite functionality almost done