Updated functions

Merged array merge function into seperate function so it can be used
globally.
Completed Query function

Completed query function. added third argument for callback once data
recieved.