small restrucutre, inclusion of subtraction method, and implementation of tests.