Calculating k is now way faster