improve hull algorithm