bug fixed and organized the structure