Fixing the duplicate threads issue. Also freeing a result or two.