Adding factory constructor to Database