refactoring script for dispatch re-do, work in progress