transform more functions to defun form. remove R macro.