DRY the code out a little