refactor crypto