Made key checking more concise

Last commit, I said it could probably be done better. I found a way.