enhance module by providing user specified exchanges, do some refactoring, code deduplication