Add comments and fix a small bug with deselecting