Trying to cut down on code duplication