Almost finalised code base

Massive update to code base though not complete