rewrote piecewise tree structure creation; use multithreading; ui