Added window movement stuff from Mark
Migrated to autowrite option