Load mgcv package when needed
Cleaner method for checking if package is installed

Previously the package would be loaded (if installed) as a side effect.
Now the function doesn't automatically load the package.