note original oracle copyright has been preserved as this code has just being moved to a new source/header file