Work in progress: refactoring paths, adding TCP fallback.