Added database management. Made some values configurable