Add database support; Better logging