Fixing up some and testing some various cases.