removing listeners appropriately to fix background vs foreground issues