Update packages, improve some utility code