restructure the code into meaningful units