Changing the background color

Minimize code duplication.