Correct padding calculation. Generates correct file now