implemented exception handling feature