Download functionality updated, now download with polygon works. Cleaned up some code