Another way to do key checking