Updated media adding function and media tests.

Some more updates to media handling and testing.