prepare tests for better caching mechanism
moves var to top
adds cache store per resource, and a flush function
better caching
cleaner code
moves helpers to the back