DRY-ed things up a bit