Update JS codegen to use CoreFn directly
Refactor JS Common stuff