FYI you can just add the condition check to this line. But this works as well.