change background color and square colors and create intermediate groupings on click