Removing unused code, logging on exception