Added UnitTests, updated documents.