i've seen this code before.  Opportunity for refactoring?