Improved Database class