Flat is better than nested. Nested functions are first step to evil - move it out of scope if possible.