Move getData method from Main to Connect