Split out common code to pkglib_util. Make pkglib_testing standalone. Merged the last of the AHL code in