Made changes to queries and fixed headers