Complete rework with fragments.

Took me ages to write this, Timecube better not delete this!