re-organize the script