Added reference JS implementation and started nativization.