DRY out the code a bit.