added various js functionality.