Made PDF creation code more readable.