Currently, it gets a little confusing following which assignment goes where. I'd prefer this as an else statement chained with the following if {..} else if {..}. This would also allow you to remove the ```cachedState.target = cachedTarget;``` line out of here, as this is already done just before the function returns.