A court is to apply, where appropriate, the principle that restrictions on the defendant's freedom and personal autonomy should be kept to the minimum consistent with the safety of the community when determining (a) which order to make under section 18(2) or 21(1) or this Part; or(b) whether to discharge or vary such an order; or(c) the conditions of such an order.