improved time checking, improved EmailSender usage, updated tests