took if statement out of loop since its const