Views: improve code to respect the DRY principle.