Implement logging to db every 5 seconds.
Whitespace fixes.