refactorized, passing dispatcher to server, dispatcher maybe chosen during compilation
dispatcher option