re-engineering this script to use new refactor structure