Dry'ed out the code

- Removed repetitive code
- removed global reference - `Error`
- removed unreferenced variable - `originalError`