cleanup and refactoring of single item encryption