Remove one duplicaton of code