Improved tree generation and implemented dnd.