changes to support random file names and viewer