Readded database functionality