added leaf stuff after messy merge