update lib/*.sh with fancier versions from omniti-ms branch (versions as of 20130401)