clean up and adding errorHandler