Add database class and unit tests