optimisations by François