added key logic