removed one variable that is for middle