Refactored into separate header/implementation.