Generalize and remove use of error