some logic related to the background rectangle