Reorganize code
Further use of email model