getting ride of double lines of code