revert rethrowError + code clean up