did the best re-factor ever getting rid of about 10 lines with a change in control flow