Added ServerCommunication class and moved login code there