quick win function refactoring