Fixed download issue by using get instead of request method of https api. Refactored code to add best practices.
Added module pattern. Removed extra variables and added some more methods