uncommented code to auto login and added cache.