Refactoring stub controller processing (in progress)