Minor refactors and fixed issues in connecting to open network