Added sorting functionality to media view.