Refactored to move methods to Utils.