Refactored into importable methods.