Added initial modifications to support JSNI