Implemented server side optimistic loop
Merge pull request #2 from andreabalducci/jsloop

Implemented server side optimistic loop
code cleanup
Merge pull request #3 from andreabalducci/jsloop

code cleanup