Changed connection code in main.cpp