Reinstate 'Edit media' menu item

and minor code tidy