Remove Some Duplication

Remove some duplicated code.