recalculates medium