added dirty flags and rectangle colors