Implement search case and refactored DSN use case somewhat to allow more...

... reeuse of code between the two cases