JS scripting update

Code cleaning and added functions required for rendering with Three.JS