clean up keys code