Create separate R file
Expand with additional utility functions