How can i make it so my servo uses a different loop

I want it so that my servo uses a different loop so that there is not a delay when turning it
My code:

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
int motor = 13;
int led1 = 12;
int led2 = 2;

void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(motor, OUTPUT);
digitalWrite(motor, HIGH);

void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
if (val>90){
digitalWrite (led1, HIGH);
digitalWrite(led1, LOW);
if (val<90){
digitalWrite (led1, LOW);
if (val<90){
digitalWrite(led2, HIGH);
digitalWrite(led2, LOW);

Apparently, you should look into BlinkWithoutDelay example.

As you probably suspect the delay() function is causing a problem because it stops anything else happening whilst the delay() occurs. You need to use a different timing method.

Have a look at Using millis() for timing. A beginners guide, Several things at the same time and look at the BlinkWithoutDelay example in the IDE.