Moved maxw reduction outside