Various more or less useful optimisations