Refactor for pmg3.