various functions for prestonlab