After reviewing the rest of the code, this side effect may be acceptable. I leave it at your discretion whether or not to change this.