Preparations before calculation