Structured the code