Optimize classes Quantities and Dimensionless