adding more tests and altering code to handle variants better