Fixed Syntax errors and yes more math.

There errors, i.e. missing semicolons, no return statements on non-void
functions, etc.