refactoring...not sure I like the new code any better