prune down code duplication a bit.