cache-control header added. small refactoring