Refactoring to key store services