Changed to the right #include library for max.
Most things working, missing remove and clear.