improvements to analysis script