Rework database class