fixed memory error, tidied up login process; currently NOT the correct server