refactor gp framework