Refactor upgrade controller for rerun and analytics support