refactored into named function