Refactor the code due to the change of abtest model