added some basic database functionality from Rae