TREES! (attempting to optimize code)