Refactored common code from measure and score scanElements to segment