Added a stack and changes to use a macro with QoS