Kevin added functions to matR-apps.R