improved if statement