[tidy] extract function