Fixed failing test by updating test JSON to respect new traits JSON layout.
Finished adding rest of mathematically expressions, reorganized code a bit to improve readability.