refactor finding available slaves