This function appears duplicated?  Should be moved into a helper of some sort.