simplify getKey function