Updated JS core; better JS context initialisation