First commit of code. Incomplete formalised implementation.