Use source variable when getting media attribute.

When retrieving the media attribute from a source, use the source variable on the line above rather than using sources[j] again.
Merge pull request #137 from mdrummond/refactor

Use source variable when getting media attribute.