beginnings of error checking