Refactor of JS code and decision Tree UI