optimized the hierarchy of the program