Yep, this should work, too And you don't need the boolean variable... this is the better solution.