Refactor crypto module
Refactor the model module
Update tests