Imported from https://github.com/toxtli/AutomEditor