had to clean up Perl a bit; add special case of cross in @n