Refactoring utils.