Fixed the subtraction logic. Added Tests