Improved the way permissions work around view/download; some bug fixes