[native modules] Minor refactoring