Updated to finished version

Advanced sections completed, code has been optimised and made more
modular.