Move lock into timer body.
Fix null assignment errors
Do not print message if no new emails