Implement and finish exception handling