refactor slave