Modularize analysis code