improved query and qif parser