Finished chapet 2, implemented unittest.