Sorted out behaviour of destructors etc
Sorted out style of C code