refactored to code be moew generic
added demo server impl and coded example to use it