Improved analysis program in Python