Organizing some code

just organized the hierarchy of some code