Refactoring of exc function.