Added JS API and split off shell access into a separate script