Refactor and collapse header