duplicated code extracted to a new method