slight refactor of cache-control logic to be more robust
cleanup metadata