Allow files to be viewed from amazon s3 or with query string

I have added clean up code in order to get rid of query string. It will allow user to put the s3 urls.