Move utility functions to utils.r
Rd: omit description if it is the same as title, #7