cleaned up some code in analysis script