code organization& explaination