Optimisations, basic tests, tweaks