avoid duplicate code