Made some changes to the library loading and put in some framework to
prepare for saving modified libraries.