change doreturn to when