tested final.pl with subset1 and subset2 using files written by myself. have found some bugs in subset2. will attempt to rewrite it