start of native implementation