Refactored utility2