some speed-up in solve by keeping track of current dictionary node