fixed loop indentation and typo mistakes