Functions needed for viewer