[tidy] extract functions