key.cpp updated