reorder imports garbled in a rebase
Added tests, fixed up the escape callback