Handling of background and foreground objects