Updating/Refactoring connect and newconnect creating the function getNextAvailableRoom