improve new refactoring
there are still some huge bugs