organized the code