refactored get_available_name and removed dummy except