restructured the core part