added support for RTL maths