Reorganized code; split tree and system code