updated function.