Readability update

Modified code to:
- enhance readability (simpler NULL checks, declaring variables in for loops, etc.)
- remove unneeded code
- remove implicit conversions that lose precision
- change compiler C standard settings