fixed nested loops , removed unnececary blocks identation fix