better version of genlinks.hs