Added tests and now checks that cache key is only added if flag is displayed.