Add getOptionalConnection
Tidy up.
Merge pull request #102 from greboid/optional-connection

Add getOptionalConnection