Clean the code related to media objects