Added loop forward and backward