Added database functionality (I think)