Adding TreeImage class
refatoring