initial implementation with 100 percent coverage and a few corner cases.