Addes some tests (and found a calculation bug)