cleaned up code, created tree print on call