Added custom function/variable simplifying, improved the cropping and caching algorithms and fixed some bugs with the structure of the math classes.