API Clean up and login/logout functionality