improved integer parsing; renamed pre to calculate