Maybe splitting the function (as suggested by @lorenzo, if I understood correctly at IRC), repeating some tests or creating a new var I believe. I'll sketch up something.