added database class and supporting classes