Refactored utilities.