Updated logic for background