More math improvements