Modified for PS v1.6, added PF hooks, fixed multicurrency, currency decimal and amount rounding