corrected choose function