Refactored utility methods into a separate class.