improve arm selection function