{Update} Copied query functionality into new js file.