Made the database class a singleton to avoid db locking