Remove duplicated logic.