added an API: /logout
added an API: /login
code clean up