keycheck code and tests