change 'endfor' and 'endif' to 'end'