added mgcv functions