refactor inner structure