major improvements and fixes to calculations when buying and selling currencies