refactoring ecs