Pass the done variable instead of having it as a global.
Don't return anymore but use variable done.