refactor log module
refactor email queue module