Tidied-up the exception handling