Add files for best effort apply-variants algorithm.
Fix some bugs introduced from refactoring; added test cases.
Small fixes to make this work with rec1_c321d.