Alternate solution for issue #275 that removes some unnecessary code duplication.