Some more logic. See #319