deleted two variable for loops in head and foot
deleted two variable for loops in head and foot