General updates, optimisation and documentation