cleanup-refactor

Simplify code and remove legacy/backcompat shims while preserving behavior. Use when asked to clean up or simplify code.