Some helpful functions for R:GBM