Rewrote keys with explicit recursion

Speed up by about 10% for `keys` and `keysSet`