Added caching of login details and added logout functionality