Fixed problems with indentation and for loop logic