Reducing duplications in code