improved result analysis script