modifying to allow error tracking