first set of calculations