Pre calculation