Refactor to avoid inheritance when possible.