Added handler to reconnect on a lost database connection. Resolves #7