remove duplicated lines of code