refactored for guard