revamped connectToServer, updated parsing