Edited to allow dynamic library generation