Fixing output var incorrectly being called as data 

Also, removed unnecessary call to setHeaders