improved result handling