refactoring - midprocess