ch7 - solved problem with heavy memory allocation