save current date-time when saving messages

reorder imports, PEP-8 changes