login handler and small changes