Add key active state logic