in reply to loop problem

You never say what isn't working or what error message you are getting. I had to invest a few minutes just to find out what you could have easily told us

So you use recursion to simulate a loop (nothing wrong with that, TMTOWTDI). But you try to exit your recursion with last. And the error message just tells you that there is no loop to 'last' out of. Use return instead or as you already do just don't call Edit() again when you want to stop the recursion.

So the only thing wrong with your program is a useless 'last' that you can delete and then your program works