A lot of changes and fixes for keys