Moved Javascripts into js files