remove duplicate code in consequent lines