Duplicate code removal

Hi Mark, here is just a minor cleanup. Also my first pull request ever, so to take advantage of it.