modified the structure and fixed prolems