Minor code cleanup.
Math fixes for 64bit.