Started added test suite. Fixed a bug.