Committing initial code.
Comming the latest code that I've completed today this has now been tested and is working as required.