Now using a generated handler concept in server code.

Can be easily ported to the client side handler code.