Redis and fixes

Changed tabs to spaces, implemented redis for caching, removed API key from code (using environment variable now), added some JSON API calls.