Yes, that's what I did first. This even makes the program smaller as I don't need to worry about returning values. The problem with this however was that in cases where there are a lot of solutions it was crashing my browser. I guess that JavaScript really isn't the ideal language for this type of program. I should have written it in Java or C (it is practically identical anyway) but I actually wrote it as an exercise for learning JavaScript (it is my first JS program).