synchAllNodes function moved to external script module, better
reuseability.