Added some functions for reading the database