added caching for sessions; did some cleanup