dealing with *modifies val* and what to do when it is transitively modified through another procedure call