Moved all javascript code to exernal files except for the libraries..