Added database class and query