Reducing rational expressions to lowest terms