Refactoring to reduce duplicated code

Found some inconsistencies in duplicated code, and refactored to address
it.  More to come along these lines.