More work on the rewrite script for controls. Still not really working, so I'm just saving the script as-is for now.