problem13 + start problem 14 (TODO optim)