improved key encryption