start adding some error checking