Helper for safe free's

Added helper procedures that perform the freeing, while being a bit
more readable
Cleaned up the code just a little
Fixed the wraparound

Further improved the particle wrap around, using clipping in openGL and
adjustments to the math