Added ability to call JS functions on UI.
Added docs and memory clean up for js function calls.