refactor ghost setup