A working version that deals with latency. There is a considerable amount of refactoring to do, but this works as it should.
Added the missing files!