added handling for the background