fixed bug in parseQuery, changed image viewer code to be a bit more robust and also we can now change the image in the image viewer by double clicking on a new image