Added proper key version support