convert global function to instance prototype