improv the aglorithm finding MST