Optimize classes Quantities and Dimensionless

Done.