#8 extract duplicated code to separate methods