added media object and did some bug fixes