Changed loops from i-1:i+1 to -1:1; Simplified tign_update, now it does
only one loop