added support for multivariable functions and simplified even more fractions