Use bc_math for precision calculations - fixes issue #14

And some small efficiency tweaks