Tcl solution. Slow!