Updated javascript interface. Now uses a different style of initialization.