Added unittests for corner cases.