updating fxns to be more general