Refactor structure from task 2