Add tests for generating token and email sent at time; clean-up.