Solution of #95. Slow. Need to be improved.