Add+fix some corner cases

Check the specs. Basically some weird corner cases.