start adding error detection