initial sharding scripts
fixing bug in session creation
fixing some bugs in the sharding scripts
Merge branch 'sharding'

Rebasing and merging pull request #180