Use bcmath directly, refactor
Add some tests