Borrow some utility code which might be used