Fixed to return filename and improved security for the private api key