Refactor of Exception Code