implementation of native methods