Slight change to tool.Q.onStateChanged