factored out common code to a common.sh script and reference it in other scripts rather than duplicating the code.