moved all libraries code to libraries.js