Fixed compile errors and changed some things

Fixed compile errors and warnings when the source code is used directly
within a Unity3D project.
Changed some minor things based on personal preference.