rewrote getKey method