updated keys logic