Unit tests were added. Bug fixes.