nested loops and re-using variables again, argggg