Added many views in a loop and reduced common code