Fixed minor problems

I now pick up links in the first row of all tables. I also made some minor efficiency improvements.