Refactor how headers are set and set cache policy