slight refactoring of functional code in common