Some cleanup; a lot of work on deleting media states - some work remains.