this check only needs to be made the first time--it should be moved out of this function.