Add some comments to help navigate the onCommand event, which is a bit too monolithic