Loop optimization

shape