Added precalculation of magics