re-organize tasks and analysis code