Remove several lines of duplicate code.