[Fixes #80323222] Cleanup code & fix tests