Add function apply for trial