refactored if macs