move more duplicate code to function library

On branch master
Changes to be committed:

	modified:   setup2.sh