cleaned up code a little bit, implemented better trees