Small edits
Streamlined Sort for simpler code and some efficiency
Updated Insert to match the Scan, the escaping of the $ seems sensible