added hierarchy to controllers according to DOM