Rewrite of analysis script.