remove duplicated logic