refactor proc