some refactoring & started impl. of parsing media references