minor cleanup
one script for both arches
common functions