Some cleanup.
Localized bug. Case 3 is handled for sure not correct somehow.