Massive refactoring of fbserver.c.