Added Logout command and improved user management
Added missing using and rw.Flush()