Implemented login protocol and logout