Refactored so that invalid servers aren't added to the database.