Only build data structures if really necessary.