Revisited documentation. Minor changes in tests. Code cleanup.