Did some re-formatting and breaking the project into seperate translation units. Added clipping.

Introduced a nasty memory bug that needs fixing :-/