Adding other array method calls
correct syntax errors, improve use of query