analysis and plotting functions changed