updated function method