Improved KeyStorage class