Rearranged some of LibraryServer so that variables are initialized before use.