refactor for ghost structure