moved quantity functions to QuantityCtrl