pre-calculations