First working - ish- build...

Need to put in pings etc
Added ping messages and fixed some bugs