added some bg logic