Fix precedence error and simplify equation