Refactoring of crypt