Refactor trainer code.