refactor the structure