Multiserver support

This pull request contains multiserver support.

For some unknown reason it also contains lot of old commits.

Commits that should be merged are started from "4da7ec5"
Probably they should be merged using cherry-picking http://mispdev.blogspot.nl/2013/02/github-cherry-picking-commits-from-pull.html