Added multi-currency support and some code optimization.