refactor method to return only one free port instead of returning the list of free ports