DRY up the code some.