converting vector maths to macros