added authentication over file download and collection download
various code refactored