New format support, cosmetic changes

Added query variable, added support for PSD format