Made Makefile a lot nicer.
Fixed overflow check (now it won't fail).
Changed length types to unsigned.
Changed some tabs to spaces as appropriate.