Media retrieval refactor; first pass