Add basic macro code
Extract macro code to function and add speed