big improvement on 106 (ideas from youz's solution)